<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8" />
		<title>编辑角色</title>
		<div th:replace="common/common_form_header"></div>
	</head>
<body>
	<div class="building-details" id="building-details">
	    <div class="layui-tab-content">
			<div id="defaultForm" class="layui-form" >
				<input type="hidden" id="id" name="id" th:value="${orgrole.id}" >
				
				<div class="layui-form-item">
					<label class="layui-form-label">角色名称</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input" lay-verify="required" placeholder="请输入角色名" name="roleName" th:value="${orgrole.roleName}"/>
					</div>
				</div>
				
				<div class="layui-form-item">
					<label class="layui-form-label">排序号</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input" name="sortNumber" id="sortNumber" th:value="${orgrole.sortNumber}">
					</div>
				</div>
				
				<div class="layui-form-item">
					<label class="layui-form-label">描述</label>
					<div class="layui-input-block">
						<textarea name="roleDesc" id="roleDesc" class="layui-textarea" th:inline="text">[[${orgrole.roleDesc}]]</textarea>
					</div>
				</div>
				
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button type="button" class="layui-btn layui-btn-primary" onclick="closeLayer()">取消</button>
						<button type="button" lay-submit class="layui-btn" lay-filter="*" >保存</button>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript" th:inline="javascript">
	layui.use(["layer","form"], function(){
		var form=layui.form;
		form.on('submit(*)', function(data){
			console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
			$.post("/system/org/role/update",data.field,function(res){
				console.log(res);
				if(res.code==200){
					layer.alert(res.msg,function(){
						parent.location.reload();
					});
				}
			});
			return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
		});
		
	});
</script>
</html>